package com.eliza.springboot.v3.config

import com.eliza.springboot.v3.model.Greeting
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.boot.SpringBootConfiguration
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import org.springframework.context.annotation.Scope
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer


//注册组件
//@Import() //导入第三方包中的组件(名字为全类名) = @Configuration + @Bean =@Component class
@SpringBootConfiguration
@Configuration
class Bean {
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)//取消单利模式
    @Bean("Greeting") //默认单实例
    fun Greeting(): Greeting {
        return Greeting(0, "a")
    }

}